import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import type { NavItem } from '/@/types/nav'

export function useNavigation() {
  const showCreateDialog = ref(false)
  const showDataSourceDialog = ref(false)
  const showPushDialog = ref(false)

  // 处理创建项目
  const handleCreateProject = () => {
    showCreateDialog.value = true
  }

  // 处理数据源
  const handleDataSource = () => {
    showDataSourceDialog.value = true
  }

  // 处理数据源创建成功
  const handleDataSourceCreated = (data: any) => {
    console.log('数据源创建成功:', data)
    // TODO: 处理数据源创建成功后的逻辑
  }

  // 处理推送
  const handlePush = () => {
    showPushDialog.value = true
  }

  // 处理推送创建成功
  const handlePushCreated = (data: any) => {
    console.log('推送创建成功:', data)
    // TODO: 处理推送创建成功后的逻辑
  }

  // 处理导航项点击
  const handleNavClick = (id: number) => {
    switch (id) {
      case 1:
        handleCreateProject()
        break
      case 5:
        handleDataSource()
        break
      case 6:
        handlePush()
        break
      default:
        ElMessage.info('功能开发中...')
        break
    }
  }

  return {
    showCreateDialog,
    showDataSourceDialog,
    showPushDialog,
    handleNavClick,
    handleDataSourceCreated,
    handlePushCreated
  }
} 